home *** CD-ROM | disk | FTP | other *** search
- Overlay Spawn Function
-
-
- description:
-
- This diskette contains the following library: SPAWNS.
- This is for use with programs written using the small memory model.
- This library contains the following function: spawn, spawnp and
- spawne.
-
- Spawn.
-
- This function takes as parameters a program name and any parameters that
- are to be passed to this program. Before executing the new program spawn
- will swap to either EMS, and or, Disk the current program leaving only a
- small kernel in memory. On termination of the spawned program to function
- will restore the parent from EMS, and or Disk.
-
- Usage:
-
- spawn("d:\file_path\file_name","arg1","arg2",NULL);
-
- arg1, arg2 are pointers to NULL terminated strings.
-
- You must supply the full file name i.e "CL.EXE" not "CL".
- The arguement list must be terminated by a NULL.
- the length of all the arguements must not exceed 128 bytes.
-
- upon invocation spawn will verify that the parameters do not exceed
- 128 bytes. It will then save all memory belonging to the current program
- in either EMS or Disk. It will save as much to EMS as it can and will
- then start saving to Disk. After saving everything it shrinks the current
- programs memory usage to about 800 Bytes and invokes the program passed.
- Upon return spawn restores memory from either EMS or Disk. Frees the EMS
- pages and deletes the swap file. Control is then returned back to the
- calling program.
-
- These functions can be called from 'C' programs only.
-
- Include stdio.h and stdlib.h in your C code.
- Do not pass pointers to the parents data as arguements to the child
- program.
-
- spawnp.
-
- This function will look in the current directory for the program to
- execute. If it does not find it there it will the PATH= environment
- variable. If it finds the program it will invoke spawn.
-
- usage is spawnp("CL.EXE","arg1","arg2",NULL);
-
- arg1, arg2 are pointers to NULL terminated strings.
-
- spawne.
-
- Usage is spawne("C:\\MYPROG.EXE\\","arg1","arg2",NULL,env);
-
- You must supply the full path and name of the executeable.
- arg1,arg2 are pointers to NULL terminated strings.
- env is of the following form:
-
- char *env[ ] = {"PROMPT=$P$G",
- "COMSPEC=C:\\COMMAND.COM",
- NULL };
-
- This function will invoke the child program setting its environment to
- the passed strings. It will then invoke spawn to swap the parent program
- to disk and execute the child
- All these functions return either the child programs return code or -1
- on error. On an error the global external ERRNO will be set to the
- following values.
-
- 2 - Program not found
- 3 - Path not found
- 5 - Access denied
- 8 - Not enough memory
-
-
- For a $15 registration fee you will receive the Large,Medium and compact
- Model librarys. Please include $2 for postage etc.
-
-
- send your check to Steve Bridges
- 1391 union street
- Manchester NH 03104.
-
-
- As usual you use this function as is at your own risk.
-
-
-